
package com.hlkj.pay.controller.openapi.callback;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.hlkj.pay.app.merchant.ext.MerchantExtConstant;
import com.hlkj.pay.app.payment.IMerchantPaymentAppService;
import com.hlkj.pay.controller.BaseController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;

/**
 * @author HlpayTeam
 * @date 2024/09/12 11:32
 */
@Tag(name = "商户交易第三方回调")
@RestController
@RequestMapping("")
@RequiredArgsConstructor
public class OrderPaymentCallBackController extends BaseController {

    private final IMerchantPaymentAppService merchantPaymentAppService;

    @Operation(summary = "订单状态回调")
    @RequestMapping(value = MerchantExtConstant.MERCHANT_PAYMENT_ASYNC_CALLBACK_URL + "/{paymentId}", produces = "text/plain", method = {RequestMethod.GET, RequestMethod.POST})
    String orderStatusCallBack(@PathVariable("paymentId") String paymentId, HttpServletRequest httpServletRequest) {
        return merchantPaymentAppService.orderStatusCallBack(paymentId, httpServletRequest);
    }
    @Operation(summary = "订单状态回调")
    @RequestMapping(value = MerchantExtConstant.MERCHANT_PAYMENT_ASYNC_FIX_CALLBACK_URL + "/{channelCode}", produces = "text/plain", method = {RequestMethod.GET, RequestMethod.POST})
    String orderStatusFixCallBack(@PathVariable("channelCode") String channelCode, HttpServletRequest httpServletRequest) {
        return merchantPaymentAppService.orderStatusFixCallBack(channelCode, httpServletRequest);
    }

}
